import {createSlice,PayloadAction} from '@reduxjs/toolkit'
import {User} from "../../../api/interface";
export interface UserState {
    userinfo:User.Userinfo,
}

const initialState:UserState = {
    userinfo:{
        username:''
    }
}
export const userSlice = createSlice({
    name: 'user',
    initialState,
    reducers: {
        setUserinfo:(state:UserState,action:PayloadAction<UserState>)=>{
            state.userinfo = action.payload.userinfo 
        }
    }
})

export const { setUserinfo } = userSlice.actions;

export default userSlice.reducer;